<?php session_start(); ?>
<link rel="stylesheet" href="standard.css" type="text/css" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

 <!--<meta http-equiv='refresh' content='0;URL=admin_vdotype.php'>  -->
 <table width="100%" border="0" cellspacing="0" cellpadding="0">
   <tr>
     <td align="center"><p>&nbsp;</p>
     <p>&nbsp;</p>
     <table width="1024" border="0" cellspacing="0" cellpadding="0">
       <tr>
         <td width="25" height="25" background="img/tb/tb_left_top.jpg">&nbsp;</td>
         <td height="25" background="img/tb/tb_top.jpg">&nbsp;</td>
         <td width="25" height="25" background="img/tb/tb_right_top.jpg">&nbsp;</td>
       </tr>
       <tr>
         <td width="25" align="left" background="img/tb/tb_left.jpg">&nbsp;</td>
         <td align="center"><table width="100%" border="0" cellspacing="0" cellpadding="0">
             <tr>
               <td height="30" align="left" bgcolor="#CCFF00" class="style7"><span class="scapmain style7">&nbsp;<img src="img/img05.gif" align="absbottom" /></span> ยืนยันการลบข้อมูล - ประเภทผู้ใช้บริการ</td>
             </tr>
             <tr>
               <td align="center" bgcolor="#FFFFFF"><p>&nbsp;</p>
                   <p>
<?php


	$username =$_SESSION['sess_Username'] ;
	$password =$_SESSION['sess_Password'] ;
	$emp_id_old =$_SESSION['sess_ID'];
	
	       									
	include "connectdb.php" ;
//	$sql2 = "select count(emp_username) from ag_employee where emp_username='$username'  and emp_password='$password' ;";
//	$result=mysql_db_query($dbname,$sql2) ;
//	$r2 = mysql_fetch_array($result);

//if ($r2 ='1') {
if($emp_id_old != $id){   //===== ตรวจสอบว่าซ้ำกับรหัสเราหรือไม่ =====//

		if(!$delete){
			$SQL_SELECT_ADMIN="SELECT * FROM ag_employee where emp_id='$id';";
			$dbquery=mysql_db_query($dbname,$SQL_SELECT_ADMIN);
			$result = mysql_fetch_array($dbquery);
			$emp_id= $result[emp_id];
			$emp_name  = $result[emp_name];
			$emp_lname  = $result[emp_lname];
				
			echo"<br><br><br>";
			echo"<center><form method=post  acton=$PHP_SELF >";
			echo"<font color=red>คุณต้องการลบผู้ดูแลระบบหมายเลข : <b>$emp_id - $emp_name $emp_lname</b> <br>ใช่หรือไม่?</font>";
			echo"<br><br><br>";
			echo "<input type=submit value=ตกลง  name=delete>&nbsp;<input type=button value=ยกเลิก onclick=history.back();>";
			echo "</form></center>";
		}else{
			$SQL_DELETE_ADMIN="DELETE FROM ag_employee where emp_id='$id'";
			$dbquery=mysql_db_query($dbname,$SQL_DELETE_ADMIN);
			echo"<center><br><font color=red>ลบข้อมูลเรียบร้อย</font><br><br><br>";
			echo"<input type=button value=ตกลง  onclick=window.location='admin_list.php';></center>";
			mysql_close();//ปิดการเชื่อมต่อฐานข้อมูล
		}
		
}else{
	?>
	<script>
	alert("ไม่สามารถลบข้อมูลได้")
	history.back();
	
/*	if(confirm("This page has been moved to a new location... would you like to be redirected?"))
	{
	location = "http://www.clickmedesign.com";
	}
	else
	{
	history.back();
	}*/


	</script>
	<?
}
?>
			</p>
                 <p>&nbsp;</p>
                 <p>&nbsp;</p>
                 <p>&nbsp;</p></td>
             </tr>
             <tr>
               <td height="25" bgcolor="#CCFF00">&nbsp;</td>
             </tr>
         </table></td>
         <td width="25" align="right" background="img/tb/tb_right.jpg">&nbsp;</td>
       </tr>
       <tr>
         <td width="25" height="25" background="img/tb/tb_left_foot.jpg">&nbsp;</td>
         <td height="25" background="img/tb/tb_foot.jpg">&nbsp;</td>
         <td width="25" height="25" background="img/tb/tb_right_foot.jpg">&nbsp;</td>
       </tr>
     </table>     <p>&nbsp;</p></td>
   </tr>
 </table>
 